a[100];main(n,k,h,t,c,s){for(gets(&n);~scanf("%d%d",&n,&k);printf("%d\n",c)){for(h=0;h<n;scanf("%d",a+h++));for(h=t=c=0;h<n;t=++h,s=0)while(t<n)s+=a[t++],c+=!(s%k);}}
